package com.egghiro.j2se.game.sace.state.actorstate;

import com.egghiro.framework.j2se.game.controller.action.GoRoundAction;
import com.egghiro.framework.j2se.game.core.model.actor.IPoint2D;
import com.egghiro.framework.j2se.game.core.view.canvas.SGraphics;
import com.egghiro.j2se.game.sace.model.actor.Flyer;
/**
 * 顺时针公转<br>
 * 附带自转
 * @project SACE
 * @designPattern 
 * @characterInPattern
 * @version 0.1
 */
public class RevolutionClockwiseState extends FlyerState {
    /**
     * 自转角速度
     */
    private final double ROTATION_STEP_IN_DIGREE;

    private GoRoundAction goRoundAction;

    /**
     * 
     * @param flyer
     * @param center 中心点
     * @param rotationStartInDigree 自转初始位置(角度)
     * @param rotationStepInDigree 自转角速度
     * @param radius 公转半径
     * @param revolutionStartInDigree 公转初始位置(角度)
     * @param revolutionStepInDigree 公转角速度
     */
    public RevolutionClockwiseState(Flyer flyer, IPoint2D center,double rotationStartInDigree,double rotationStepInDigree, 
            double radius, double revolutionStartInDigree, double revolutionStepInDigree) {
        super(flyer, 0,rotationStartInDigree);// 自身的速度向量只使用方向以实现自转。速度设为0
        this.ROTATION_STEP_IN_DIGREE = rotationStepInDigree;
        this.goRoundAction = new GoRoundAction(flyer, center, radius, revolutionStartInDigree, revolutionStepInDigree);

    }

    @Override
    public void countDown() {
        // TODO 自動生成されたメソッド・スタブ
    }

    @Override
    public void act() {
        // 自转
        speed.turn(ROTATION_STEP_IN_DIGREE);

        // 公转
        goRoundAction.act();
    }

    @Override
    public void render(SGraphics g) {
        getFlyer().renderGeneral(g);
    }
    
}